import java.util.Scanner;

public class Text {
    public static void main(String[] args) {
        int n=0;
        char pos1='A',pos2='B',pos3='C';
        System.out.print("请输入个数：");
        Scanner scanner =new Scanner(System.in);
        n=scanner.nextInt();
        hanoi(pos1,pos2,pos3,n);
    }
    public static void move(char pos1,char pos3){
        System.out.print(pos1+"->"+pos3+' ');
    }
    public static void hanoi(char pos1,char pos2,char pos3,int n){
        if(n==1){
            move(pos1,pos3);
        }else{
            hanoi(pos1,pos2,pos3,n-1);
            move(pos1,pos3);
            hanoi(pos2,pos1,pos3,n-1);
        }
    }
}
